package com.spica.platform.user.service;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spica.platform.base.model.LoginAppUser;
import com.spica.platform.base.model.PageResult;
import com.spica.platform.base.model.SysUser;
import com.spica.platform.db.service.IService;
import com.spica.platform.user.model.SysUserExcel;
import com.spica.platform.user.model.request.SysUserQueryParam;

import java.util.List;

public interface ISysUserService extends IService<SysUser> {

	/**
	 * 根据用户名查询用户
	 */
	SysUser findSysUserByUsername(String username);

	SysUser findSysUserByMobile(String username);

	/**
	 * 通过SysUser 转换为 LoginAppUser，把roles和permissions也查询出来
	 */
	LoginAppUser findLoginAppUserBySysUser(SysUser sysUser);

	SysUser findSysUserByOpenId(String username);

	/**
	 * 用户列表
	 */
	PageResult<SysUser> findSysUsersByParam(Page<SysUser> page, SysUserQueryParam sysUserQueryParam);

	/**
	 * 状态变更
	 */
	boolean updateAccountStatus(Long id, Integer accountStatus);

	/**
	 * 更新密码
	 */
	boolean updatePassword(Long id, String oldPassword, String newPassword);

	/**
	 * 删除用户
	 */
	boolean delUser(Long id);

	boolean saveOrUpdateUser(SysUser sysUser)  ;

	/**
	 * 查询全部用户
	 */
	List<SysUserExcel> findAllUsers(SysUserQueryParam sysUserQueryParam);
}
